package com.huarun.common.util;

import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.util.HashMap;
import java.util.Map;


public class Test {
	
	public static void main(String[] args) {
		
		try {
			
			HttpRequest hq = new HttpRequest();
			String url = "http://112.95.153.74:8083/auth/login";
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("username", "hrzd@megvii.com");
			map.put("password", "123456");
			String[] result = hq.sendPost(url,map);
			System.out.println(result[0]);
			System.out.println("##########");
			System.out.println(result[1]);
			
			
			String cookie = result[1];
			
			String url2 = "http://112.95.153.74:8083/mobile-admin/subjects/list?"; 
			Map<String, Object> map2 = new HashMap<String, Object>();
			map2.put("category", "employee");
			map2.put("name", "");
			map2.put("order", "");
			map2.put("page", 1);
			map2.put("size", 10);
			
			String rs2 = hq.sendGet(url2, map2, cookie);
			System.out.println(rs2);
			
			
			
		} catch (UnrecoverableKeyException e) {
			e.printStackTrace();
		} catch (KeyManagementException e) {
			e.printStackTrace();
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		} catch (KeyStoreException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
}
